import math


class Vector:
    def __init__(self, lst: list):
        self._values = list(lst)

    def __repr__(self):
        return f"Vector({self._values})"

    def __str__(self):
        return f"({', '.join(str(e) for e in self._values)})"

    def __len__(self):
        return len(self._values)

    def __getitem__(self, pos):
        return self._values[pos]

    def __add__(self, other):
        assert len(self) == len(other), \
            "error in adding, Length of vectors must be same"
        return Vector([a + b for a, b in zip(self, other)])

    def __sub__(self, other):
        assert len(self) == len(other), \
            "error in adding, Length of vectors must be same"
        return Vector([a - b for a, b in zip(self, other)])

    def __mul__(self, k):
        return Vector([e * k for e in self])

    def __rmul__(self, k):
        return Vector([e * k for e in self])

    def __pos__(self):
        return self * 1

    def __neg__(self):
        return self * -1

    @classmethod
    def zeros(cls, dim):
        return cls([0] * dim)

    def norm(self):
        return math.sqrt(sum(e ** 2 for e in self))

    def normalize(self):
        return self * (1 / self.norm())

    def __truediv__(self, k):
        return self * (1 / k)

    def dot(self, other):
        assert len(self) == len(other), \
            "error is subtract, length of vector must be same"
        return sum(a * b for a, b in zip(self, other))


if __name__ == '__main__':
    v1 = Vector([1, 2, 3])

    print(v1)
    print(len(v1))

    print("-----")
    for e in v1:
        print(e)
    for i in range(len(v1)):
        print(v1[i])

    print("-----")
    v2 = Vector([10, 20, 30])
    print(v1 + v2)

    print("-----")
    print(v1 * 10)

    print("-----")
    print(Vector.zeros(10))

    print("-----")
    print(type(v1.normalize()), v1.normalize())
